//
//  ReleasViewController.m
//  cityStar
//
//  Created by joyban on 15-3-9.
//  Copyright (c) 2015年 tiny. All rights reserved.
//

#import "ReleasViewController.h"
#import "RJPlaceHolderTextView.h"

@interface ReleasViewController ()
@property (weak, nonatomic) IBOutlet RJPlaceHolderTextView *contentText;

@end

@implementation ReleasViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"回复";
    [self addBackButton];
    self.contentText.placeholder = @"请输入内容";
    __weak typeof(self)weakSelf = self;
    [self addRightButtonWithTitle:@"发送" actionBlock:^{
               NSDictionary *parameters = @{@"id":weakSelf.peopleid,
                                            @"content":weakSelf.contentText.text,
                                            @"type":@"2",
                                             };
                [HttpRequestManager postMethod:KinterFace_Releasccomment parameters:parameters completedMainBlock:^(BOOL success, id response, NSString *errMsg) {
                   DLog(@"%@",response);
                   if (success) {
                       [SVProgressHUD showSuccessWithStatus:@"评论成功"];
                       [weakSelf.navigationController popViewControllerAnimated:YES];
                   }else{
                       [SVProgressHUD showErrorWithStatus:errMsg];
                   }
                }];
    }];
}

-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    if ([text isEqualToString:@"\n"]) {
        [textView resignFirstResponder];
        return NO;
    }
    return YES;
}

-(void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
